{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class=""><a href="{:url('admin/slide/index')}">Banner列表</a></li>
            <li class="layui-this">添加Banner</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" action="{:url('admin/slide/save')}" method="post">
                    <div class="layui-form-item">
                        <label class="layui-form-label">Banner名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="Banner_name" value="" required  placeholder="请输入Banner标题(限制12字)" class="layui-input">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="layui-form-label">外部链接</label>
                        <div class="layui-input-block">
                            <input type="text" name="link" value="" required   placeholder="外部链接" class="layui-input">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="layui-form-label">排序</label>
                        <div class="layui-input-block">
                            <input type="text" name="sort" value="10"  class="layui-input">
                        </div>
                    </div>



                    <div class="layui-form-item">
                        <label class="layui-form-label">显示设置</label>
                        <div class="layui-input-block">
                            <input type="radio" name="status" value="0" title="下线" checked="checked">
                            <input type="radio" name="status" value="1" title="上线">
                        </div>
                    </div>


                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">Banner备注</label>
                        <div class="layui-input-block">
                            <textarea  name="remark" placeholder="请输入内容" class="layui-textarea"></textarea>
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="layui-form-label">Banner封面</label>
                        <div class="layui-input-block">
                            <input type="text" name="img_url" value="" class="layui-input layui-input-inline" id="Cover_Ad" style="display: none;">
                            <input type="file" name="image" lay-type="images" class="layui-upload-file" >
                            <div class="ad_index_img_box">
                                <img style="display: block; width: 92px;" src=""/>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="*">保存</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script src="__JS__/ueditor/ueditor.config.js"></script>
<script src="__JS__/ueditor/ueditor.all.min.js"></script>
{/block}
{block name="script"}
<script>


    $(function() {
        layui.upload({
            url: "/api/file_upload/upload",
            before: function(obj){
                _loadshow("正在上传");
            },
            success: function (data) {
                _loadhide();
                if (data.error === 0 && data.type === 'image') {
                    document.getElementById('Cover_Ad').value = data.url;
                    var _ad_index_img_box = $(".ad_index_img_box");//上传图片显示盒子
                    _ad_index_img_box.empty();
                    _ad_index_img_box.append(
                            '<img style="display: block; width: 92px;" src="' + data.url + '"/>'
                    );
                } else {
                    layer.msg(data.message);
                }
            }
        });
        
        $('.date').on('click', function () {
                laydate({
                    elem: this
                    ,format: 'YYYY-MM-DD hh:mm:ss'
                    ,type: 'datetime'
            })
        });
    });



</script>
{/block}